PresetListDialog.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. #if !defined(AFX_PRESETLISTDIALOG_H__CFD5DA22_01FA_11D4_A091_00104B791122__INCLUDED_)
  19. #define AFX_PRESETLISTDIALOG_H__CFD5DA22_01FA_11D4_A091_00104B791122__INCLUDED_
  20. #if _MSC_VER > 1000
  21. #pragma once
  22. #endif // _MSC_VER > 1000
  23. #include "resource.h"
  24. #include "vector.h"
  25. #include "bittype.h"
  26. #include "ntree.h"
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Forward declarations
  29. /////////////////////////////////////////////////////////////////////////////
  30. class PresetClass;
  31. /////////////////////////////////////////////////////////////////////////////
  32. //
  33. // PresetListDialogClass
  34. //
  35. /////////////////////////////////////////////////////////////////////////////
  36. class PresetListDialogClass : public CDialog
  37. {
  38. // Construction
  39. public:
  40. PresetListDialogClass (CWnd *pParent = NULL);
  41. // Dialog Data
  42. //{{AFX_DATA(PresetListDialogClass)
  43. enum { IDD = IDD_PRESET_LIST };
  44. CComboBoxEx m_ComboBox;
  45. CTreeCtrl m_PresetTreeCtrl;
  46. CListCtrl m_PresetListCtrl;
  47. //}}AFX_DATA
  48. // Overrides
  49. // ClassWizard generated virtual function overrides
  50. //{{AFX_VIRTUAL(PresetListDialogClass)
  51. protected:
  52. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  53. //}}AFX_VIRTUAL
  54. // Implementation
  55. protected:
  56. // Generated message map functions
  57. //{{AFX_MSG(PresetListDialogClass)
  58. virtual BOOL OnInitDialog();
  59. virtual void OnOK();
  60. afx_msg void OnAdd();
  61. afx_msg void OnRemove();
  62. afx_msg void OnDblclkPresetList(NMHDR* pNMHDR, LRESULT* pResult);
  63. afx_msg void OnDblclkPresetTree(NMHDR* pNMHDR, LRESULT* pResult);
  64. afx_msg void OnItemchangedPresetList(NMHDR* pNMHDR, LRESULT* pResult);
  65. afx_msg void OnSelchangedPresetTree(NMHDR* pNMHDR, LRESULT* pResult);
  66. afx_msg void OnDestroy();
  67. afx_msg void OnSelendokTypeCombo();
  68. afx_msg void OnSelchangeTypeCombo();
  69. //}}AFX_MSG
  70. DECLARE_MESSAGE_MAP()
  71. public:
  72. //////////////////////////////////////////////////////////////////
  73. // Public methods
  74. //////////////////////////////////////////////////////////////////
  75. void Set_Preset_List (DynamicVectorClass<int> *list) { m_List = list; }
  76. void Set_Class_ID (uint32 class_id) { m_RootClassID = class_id; }
  77. void Set_Selected_Class_ID (uint32 class_id) { m_ClassID = class_id; }
  78. uint32 Get_Selected_Class_ID (void) const { return m_ClassID; }
  79. void Enable_Type_Selection (bool onoff) { m_EnableTypeSel = onoff; }
  80. protected:
  81. //////////////////////////////////////////////////////////////////
  82. // Protected methods
  83. //////////////////////////////////////////////////////////////////
  84. void Add_Preset (PresetClass *preset);
  85. void Sort_Nodes (HTREEITEM root_item, bool recursive);
  86. void Update_Button_State (void);
  87. void Populate_Preset_Tree (void);
  88. void Fill_Tree (NTreeLeafClass<PresetClass *> *leaf, HTREEITEM parent_item);
  89. void Add_Factories_To_Combo (NTreeLeafClass<uint32> *leaf, int indent, int &index);
  90. void Generate_Type_List (void);
  91. //////////////////////////////////////////////////////////////////
  92. // Protected member data
  93. //////////////////////////////////////////////////////////////////
  94. DynamicVectorClass<int> * m_List;
  95. uint32 m_ClassID;
  96. uint32 m_RootClassID;
  97. bool m_EnableTypeSel;
  98. };
  99. //{{AFX_INSERT_LOCATION}}
  100. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  101. #endif // !defined(AFX_PRESETLISTDIALOG_H__CFD5DA22_01FA_11D4_A091_00104B791122__INCLUDED_)