SelectionDialog.cpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. /***********************************************************************************************
  19. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : LightMap *
  23. * *
  24. * $Archive:: /Commando/Code/Tool $*
  25. * *
  26. * $Author:: Ian_l $*
  27. * *
  28. * $Modtime:: 9/06/00 5:06p $*
  29. * *
  30. * $Revision:: 3 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. // Includes.
  36. #include "StdAfx.h"
  37. #include "LightMap.h"
  38. #include "SelectionDialog.h"
  39. #ifdef _DEBUG
  40. #define new DEBUG_NEW
  41. #undef THIS_FILE
  42. static char THIS_FILE[] = __FILE__;
  43. #endif
  44. SelectionDialog::SelectionDialog (DynamicVectorClass <char*> *listptr, CWnd* pParent /*=NULL*/)
  45. : CDialog(SelectionDialog::IDD, pParent)
  46. {
  47. //{{AFX_DATA_INIT(SelectionDialog)
  48. // NOTE: the ClassWizard will add member initialization here
  49. //}}AFX_DATA_INIT
  50. ListPtr = listptr;
  51. Selection = -1; // NOTE: Indicates no current selection.
  52. }
  53. void SelectionDialog::DoDataExchange(CDataExchange* pDX)
  54. {
  55. CDialog::DoDataExchange(pDX);
  56. //{{AFX_DATA_MAP(SelectionDialog)
  57. // NOTE: the ClassWizard will add DDX and DDV calls here
  58. //}}AFX_DATA_MAP
  59. }
  60. BEGIN_MESSAGE_MAP(SelectionDialog, CDialog)
  61. //{{AFX_MSG_MAP(SelectionDialog)
  62. ON_WM_DESTROY()
  63. //}}AFX_MSG_MAP
  64. END_MESSAGE_MAP()
  65. /////////////////////////////////////////////////////////////////////////////
  66. // SelectionDialog message handlers
  67. BOOL SelectionDialog::OnInitDialog()
  68. {
  69. CDialog::OnInitDialog();
  70. if (ListPtr != NULL) {
  71. CListBox *listboxptr = (CListBox*) GetDlgItem (IDC_SELECTION_LIST);
  72. for (int i = 0; i < ListPtr->Count(); i++) {
  73. listboxptr->AddString ((*ListPtr) [i]);
  74. }
  75. // Set the initial selection.
  76. listboxptr->SetCurSel (0);
  77. }
  78. return TRUE; // return TRUE unless you set the focus to a control
  79. // EXCEPTION: OCX Property Pages should return FALSE
  80. }
  81. void SelectionDialog::OnDestroy()
  82. {
  83. CDialog::OnDestroy();
  84. CListBox *listboxptr = (CListBox*) GetDlgItem (IDC_SELECTION_LIST);
  85. // Record the most recent list box selection.
  86. Selection = listboxptr->GetCurSel();
  87. }