StringPickerMainDialog.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // StringPickerMainDialog.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "leveledit.h"
  22. #include "StringPickerMainDialog.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. //
  30. // StringPickerMainDialogClass
  31. //
  32. /////////////////////////////////////////////////////////////////////////////
  33. StringPickerMainDialogClass::StringPickerMainDialogClass(CWnd* pParent /*=NULL*/)
  34. : TextID (0),
  35. CDialog(StringPickerMainDialogClass::IDD, pParent)
  36. {
  37. //{{AFX_DATA_INIT(StringPickerMainDialogClass)
  38. // NOTE: the ClassWizard will add member initialization here
  39. //}}AFX_DATA_INIT
  40. return ;
  41. }
  42. /////////////////////////////////////////////////////////////////////////////
  43. //
  44. // DoDataExchange
  45. //
  46. /////////////////////////////////////////////////////////////////////////////
  47. void
  48. StringPickerMainDialogClass::DoDataExchange (CDataExchange *pDX)
  49. {
  50. CDialog::DoDataExchange(pDX);
  51. //{{AFX_DATA_MAP(StringPickerMainDialogClass)
  52. // NOTE: the ClassWizard will add DDX and DDV calls here
  53. //}}AFX_DATA_MAP
  54. return ;
  55. }
  56. BEGIN_MESSAGE_MAP(StringPickerMainDialogClass, CDialog)
  57. //{{AFX_MSG_MAP(StringPickerMainDialogClass)
  58. //}}AFX_MSG_MAP
  59. END_MESSAGE_MAP()
  60. /////////////////////////////////////////////////////////////////////////
  61. //
  62. // OnInitDialog
  63. //
  64. /////////////////////////////////////////////////////////////////////////
  65. BOOL
  66. StringPickerMainDialogClass::OnInitDialog (void)
  67. {
  68. CDialog::OnInitDialog ();
  69. //
  70. // Calculate the rectangle where we are to display the string picker
  71. //
  72. CRect rect;
  73. ::GetWindowRect (::GetDlgItem (m_hWnd, IDC_PICKER_AREA), &rect);
  74. ScreenToClient (&rect);
  75. //
  76. // Create the string picker
  77. //
  78. StringPicker.Set_Selection (TextID);
  79. StringPicker.Create (this);
  80. StringPicker.SetWindowPos (NULL, rect.left, rect.top, rect.Width (), rect.Height (), SWP_NOZORDER);
  81. StringPicker.ShowWindow (SW_SHOW);
  82. return TRUE;
  83. }
  84. /////////////////////////////////////////////////////////////////////////
  85. //
  86. // OnOK
  87. //
  88. /////////////////////////////////////////////////////////////////////////
  89. void
  90. StringPickerMainDialogClass::OnOK (void)
  91. {
  92. //
  93. // Get the selected string from the picker control
  94. //
  95. TextID = StringPicker.Get_Selection ();
  96. CDialog::OnOK ();
  97. return ;
  98. }